import request from '@/utils/request'


// swiper 响应数据接口
interface SwiperData {
	appAdvertiseUrl:string,
	backgroundColor:null,
	createTime:number,
	creator:string,
	id:string,
	link:string,
	linkMomentId:string,
	linkMomentSummary:string,
	pcAdvertiseUrl:string,
	position:string,
	positionDetail:positionDetailItem[],
	title:string,
	updateTime:number,
	videoDuration:null
}
interface positionDetailItem {
	endTime:number,
	startTime:number
}
const access_token="c494ae44-3adc-48ca-8749-5128a53358d7";
export default {
	//获取轮播图
	// https://www.dance365.com/apis/promotion/ads/search/findByPosition?
	//查询字符串
	//access_token=c494ae44-3adc-48ca-8749-5128a53358d7&
	//position=pc_mainpage
	getSwiper(){
		const position="pc_mainpage";
		return request.get<any,SwiperData[]>(`/apis/promotion/ads/search/findByPosition?access_token=${access_token}&position=${position}`)
	},
	//获取推荐列表
	//https://www.dance365.com/apis/moment/moments/rec/default?
	//查询字符串
	// access_token: c494ae44-3adc-48ca-8749-5128a53358d7
	// column: recommend
	// pageSize: 20
	// pageNum: 0
	// localCache: 0
	getRecommend(pageNum=0,localCache=0){
		return request.get("https://www.dance365.com/apis/moment/moments/rec/default",{
			params:{
				access_token,
				column: 'recommend',
				pageSize: 20,
				pageNum,
				localCache
			}
		})
	},
	//获取动态列表
	///apis/moment/moments/frontDynamic/default
	//查询字符串
	// access_token: c494ae44-3adc-48ca-8749-5128a53358d7
	// pageSize: 20
	// pageNum: 1
	// column: frontDynamic
	getInformation(pageNum:number){
		if(!pageNum){
			return request.get<any,any>("/apis/moment/moments/frontDynamic/default",{
				params:{
					access_token,
					pageSize:20,
					column: "frontDynamic"
				}
			})
		}else{
			return request.get<any,any>("/apis/moment/moments/frontDynamic/default",{
				params:{
					access_token,
					pageSize:20,
					pageNum:1,
					column: "frontDynamic"
				}
			})
		}
	}
}

